﻿#ifndef AVDUMER_H
#define AVDUMER_H
#include <QThread>
#include <string>
struct AVContext;
class AAC_Decoder;
class H264_Decoder;
class AVFormatContext;
class AVDumer : public QThread
{
    Q_OBJECT
public:
    AVDumer(AVContext* ac);
    ~AVDumer();
    int Open(const std::string& path); //打开文件路径
    bool setSpeed(const uint32_t& speed);
    int64_t setSeek(const double& pos);
protected:
    void Close();
    void Clear();
    virtual void run() override;
    double audioDuration();
    double videoDuration();
private:
    int videoIndex = -1;
    int audioIndex = -1;
    std::mutex mutex_;
    AVContext* avContext_ = nullptr;
    std::atomic_bool quit_ = false;
    AAC_Decoder*  aacDecoder_ = nullptr;
    H264_Decoder* h264Decoder_ = nullptr;
    AVFormatContext* pFormateCtx_ = nullptr;
};
#endif // AVDUMER_H
